/*
 *  @author  Alpesh Mistry  <apm1dec@gmail.com>
 *  @author  Ankur Kothari  <a.kothari711@gmail.com>
 *  @author  Elman Mansimov <elman.mansimov@gmail.com>
 *  @author  Michelle Pan   <panmiche@gmail.com>
 *  @version 1.0
 *  @since   2012-03-03
 */

public abstract class SystemItem {
	
	private String name; //name of SystemItem
	private Directory parent; //parent directory of SystemItem
	
	/**
	 * Initialize SystemItem object with a name and parent directory.
	 * @param n String which is the name of SystemItem
	 * @param dir Directory which is the parent of SystemItem
	 */
	public SystemItem(String n, Directory dir){
		setName(n);
		setParent(dir);
	}
	
	/**
	 * Return name of SystemItem.
	 * @return name of SystemItem
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * Set name of SystemItem.
	 * @param n String which is new name of SystemItem
	 */
	public void setName(String n) {
		name = n;
	}
	
	/**
	 * Return parent of SystemItem.
	 * @return parent of SystemItem
	 */
	public Directory getParent() {
		return parent;
	}
	
	/**
	 * Set parent of SystemItem.
	 * @param dir Directory which is new parent of SystemItem 
	 */
	public void setParent(Directory dir) {
		parent = dir;
	}
	
	/**
	 * Recursively return the full path of any SystemItem object with non-null parent.
	 * @return path of SystemItem object.
	 */
	public String getFullPath(){
		if (parent != null)
			return parent.getFullPath() + "/" + name;
		else
			return "";
	}
	
	abstract public void printContents();	
}